<template>
  <el-form
    label-position="right"
    label-width="100px"
    size="mini"
    :inline="true"
    :model="ss"
    ref="refform"
    class="demo-form-inline wrap_inline"
  >
    <el-form-item label="上报时间">
      <el-date-picker
        v-model="value1"
        type="daterange"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
      >
      </el-date-picker>
    </el-form-item>
    <el-form-item label="类型">
      <el-select v-model="ss.serviceType" clearable class="input_inner">
        <el-option
          v-for="item in serviceTypes"
          :key="item.value"
          :label="item.name"
          :value="item.value"
        ></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="是否成功">
      <el-select v-model="ss.serviceType" clearable class="input_inner">
        <el-option
          v-for="item in serviceTypes"
          :key="item.value"
          :label="item.name"
          :value="item.value"
        ></el-option>
      </el-select>
    </el-form-item>
    <el-form-item>
      <el-button
        style="margin-left: 20px"
        class="newButtonColor btnSpace SearchBTN"
        @click="cx"
        >查询</el-button
      >
      <el-button @click="reset" class="SearchBTN cancelBTN">重置</el-button>
    </el-form-item>
  </el-form>
</template>
<style lang="scss" scoped>
.wrap_inline {
  background: #f8f8f8;
  padding: 14px 5px 0px 5px;
  .el-form-item {
    margin-bottom: 12px;
  }
}
.wrap_inline .input_inner {
  width: 120px;
}
</style>
<script>
import { mapState, mapMutations } from "vuex";
export default {
  data() {
    return {
      serviceTypes: [],
      orgTypes: [],
      regionId: [],
      ss: {
        name: null,
        type: null,
        serviceType: null,
        regionId: null,
        linkName: null,
        linkPhone: null,
      },
      defaultProps: {
        checkStrictly: true,
        children: "children",
        value: "id",
        label: "name",
      },
    };
  },
  created() {},
  computed: {
    ...mapState(["regTree"]),
  },
  methods: {
    setData() {
      this.serviceTypes = this.$parent.$parent.$parent.serviceTypes;
      this.orgTypes = this.$parent.$parent.$parent.orgTypes;
    },
    //省市区三联框点击后触发
    handleChange(value) {
      this.ss.regionId = value[value.length - 1]; //取地区里最后一个值发给后端
    },
    cx() {
      this.$parent.$parent.$parent.$refs.biaoge.cx(this.ss);
      this.$parent.$parent.$parent.$refs.biaoge.ids = null;
      this.$parent.$parent.$parent.$refs.tree.selOrg = null;
    },
    reset() {
      this.ss = {};
      this.regionId = [];
      this.$parent.$parent.$parent.$refs.biaoge.ids = null;
      this.$parent.$parent.$parent.$refs.tree.selOrg = null;
    },
    getTreeData(data) {
      for (var i = 0; i < data.length; i++) {
        if (data[i].children.length < 1) {
          data[i].children = undefined;
        } else {
          this.getTreeData(data[i].children);
        }
      }
      return data;
    },
  },
};
</script>
